Page({
    //添加缓存
    handleAdd(){
        //异步存储缓存
        // wx.setStorage({
        //   data: "张三",
        //   key: 'info',
        // })
        
        // wx.setStorageSync('info', "李四")
        let arr=[
            {id:1001,name:"八戒",weight:200},
            {id:1002,name:"悟空",weight:100},
            {id:1003,name:"唐僧",weight:120}
        ]
        wx.setStorageSync('users', arr)
    },
    //删除某一个缓存
    handleRemove(){
        wx.removeStorageSync('info')
    },
    //清除所有缓存
    handleClear(){
        wx.clearStorageSync()
    },
    //修改缓存
    handleUpdate(){
        //读取缓存
        let arr=wx.getStorageSync('users')
        //修改数据
        arr[1].weight=150
        //存储缓存
        wx.setStorageSync('users', arr)
    },
    handleInfo(){
        let result =wx.getStorageInfoSync()
        console.log(result)
    }

})